require('http').createServer(function (req, res) {
    var matchStrings = req.url.match("^/customer/([a-z,0-9]+)$");
    if (matchStrings != null && req.method == "DELETE") {
        var customerId = getIdPartOrSendUnknownRequest(res, matchStrings);
        console.log("Received delete request for customerId=" + customerId);

        setTimeout(function () {
            console.log("Deleteted customerId=" + customerId);
        }, 10000);

        res.writeHead(200);
        res.end();
    } else {
        res.writeHead(400);
        res.end()
    }
}).listen(8888);

/************************RESPONSE UTIL*********************/

getIdPartOrSendUnknownRequest = function (res, matchStrings) {
    var idPart = matchStrings[1];
    if (idPart == null) {
        res.writeHead(400);
        res.end();
    }
    else {
        return idPart;
    }
}